<template>
	<view>
		<!-- 会议详情开始 -->
		<view class="v3">

			<view class="v2">
				<view class="v1" v-if="conference.meetingenter ==1">
					<text class="t1">会议状态：</text>
					<text class="t2 tt2">等待确认</text>
				</view>
				<view class="v1" v-if="conference.meetingenter ==2">
					<text class="t1">会议状态：</text>
					<text class="t2 tt2">已确认</text>
				</view>
				<view class="v1">
					<text class="t1">会议标题：</text>
					<text class="t2">{{conference.name}}</text>
				</view>
				<view class="v1">
					<text class="t1">会议时长：</text>
					<text class="t2">{{conference.duration}}</text>
				</view>
				<view class="v1">
					<text class="t1">开始时间：</text>
					<text class="t2">{{conference.starTime}}</text>
				</view>
				<view class="v1">
					<text class="t1">会议室：</text>
					<text class="t3">{{conference.endTime}}</text>
				</view>

				<view class="v1" v-if="conference.reminder ==1">
					<text class="t1">会议提醒：</text>
					<text class="t2 tt2">提醒</text>
				</view>
				<view class="v1" v-if="conference.reminder ==2">
					<text class="t1">会议提醒：</text>
					<text class="t2 tt2">不</text>
				</view>

			</view>
		</view>
		<!-- 会议详情结束 -->

		<!-- 参与人-->
		<view class="v4">
			<view class="v7">
				<view class="v5">
					<text>参与人</text>
				</view>

				<view class="v6">
					<text>共{{renshu}}人</text>
				</view>
			</view>


			<view>
				<view>
					<u-subsection :list="list" :current="curNow" @change="sectionChange"></u-subsection>
				</view>

				<view class="vi1" v-if="update" v-for="(item, index) in lpeo">
					<view class="vi2">
						<view class="flex-row wrapper">
							<u-image class="im" :src="item.picture" width="112rpx" height="112rpx" shape="circle">
							</u-image>
							<view class="flex-col flex-row wraper-col vi3">
								<view class="text">{{item.name}}</view>
							</view>
						</view>
					</view>
				</view>


			</view>




		</view>
		<!-- 参与人结束		 -->
		<view style="background-color: #f3f8fd;width: 100%;height: 30px;"></view>
		<view style="background-color: #fff; width: 100%;height: 70px;">
			<view style="height: 10px;">

			</view>
			<view>
				<u-button @click="affirm()" class="button1" type="success" shape="circle">
					确认参加
				</u-button>
			</view>
			<view>
				<u-button @click="refuse()" class="button2" type="success" shape="circle">
					拒绝
				</u-button>
			</view>
			<!-- @change="gengduo()" -->
			<!-- 更多 -->
			<view>
				<u-popup :show="show" @close="close" @open="open">
					<view>
						<view style="width: 100%;height: 50px;">
							<text style="float: left;margin:0px 0px 0px 165px;color:#a4a09c ;">请选择</text>
						</view>
						<view>
							<u-button @click="compile()" class="butt1" type="success" shape="circle">
								编辑
							</u-button>
						</view>
						<view>
							<u-button @click="cancel()" class="butt1" type="success" shape="circle">
								取消会议
							</u-button>
						</view>

						<view>
							<u-button @click="add()" class="butt1" type="success" shape="circle">
								添加与会人
							</u-button>
						</view>
						<view style="background-color: #f2f2f2;width: 100%;height: 10px;"></view>

						<view @click="close">
							<u-button class="butt1" style="color: #a7a19c;" type="success" shape="circle">
								取消
							</u-button>
						</view>
					</view>
				</u-popup>
				<view style="width: 50px;height: 50px;background-color: #fff;float: left;margin: -41px 0px 0px 320px;">
					<u-button @click="show = true">
						<u-icon name="list" color="#2979ff" size="20" border-color="#fff"></u-icon><br>
					</u-button>
					<text style="margin:0px 0px 0px 10px;">更多</text>
				</view>
			</view>
		</view>
		<!-- 操作提示消息 -->
		<view>
			<u-toast ref="uToast"></u-toast>
			<u-cell-group title-bg-color="rgb(243, 244, 246)">
				<!-- 	<u-cell :titleStyle="{fontWeight: 500}" :title="item.title" v-for="(item, index) in list" :key="index"
					isLink :icon="item.iconUrl" @click="showToast(item)">
				</u-cell> -->
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad: function(option) {
			// console.log("接收到的参数" + option.mid);
			this.conference.mid = option.mid
		},


		data() {
			return {
				list: ['已确认', '已拒绝', '未确认'],
				curNow: 0,
				conference: {},
				renshu: 0,
				lepos: {},
				lpeo: null,
				mine: {},
				update: true,
				show: false,
				shows: false,
				lists: [{
						type: 'success',
						title: '成功主题(带图标)',
						message: "操作成功！",
						iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
					},
					{
						type: 'default',
						title: '结束后跳转标签页',
						message: "正在前往编辑会议页面！",
						url: '',
						iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/jump.png'
					}
				],
				user: {},
			}
		},
		computed: {
			getIcon() {
				return path => {
					return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
				}
			},
		},
		created() {

			this.user = uni.getStorageSync('user')
			console.log(this.user)
			// //获取用户头像
			// uni.request({
			// 	url: "http://localhost:8007/conference/social/getIdPic/" + this.user.eid,
			// 	method: 'get',
			// 	success: (res) => {
			// 		console.log(res)
			// 		this.user.picture = res.data.data.p.picture
			// 		// console.log(this.dataList[0].paytime.)
			// 	}
			// })


			console.log("接收到的参数" + this.conference.mid);
			uni.request({
				url: "http://localhost:8007/conference/mine/getIdMine/" + 1 + "/" + this.conference.mid,
				method: 'get',
				success: (res) => {
					console.log("mmmm")
					console.log(res.data.data.m)
					console.log("mmmm")
					this.conference = res.data.data.m
					this.renshu = res.data.data.lpeo.length
				}
			})
			uni.request({
				url: "http://localhost:8007/conference/mine/getIdMP/" + this.conference.mid + "/" + 1 + "/" + 1,
				method: 'get',
				success: (res) => {
					// console.log(res)
					this.lpeo = res.data.data.lpeo
					// console.log(this.lpeo[0].name)
				}
			})
		},
		methods: {
			sectionChange(index) {
				this.curNow = index;
				// console.log(this.curNow)
				if (this.curNow == 0) {
					this.mine.status = 1
				}
				if (this.curNow == 1) {
					this.mine.status = 2
				}
				if (this.curNow == 2) {
					this.mine.status = 3
				}
				// console.log("最终转态：：" + this.mine.status)
				// console.log("id：：" + this.conference.mid)
				this.update = false
				uni.request({
					url: "http://localhost:8007/conference/mine/getIdMP/" + this.conference.mid + "/" + this.mine
						.status + "/" + 1,
					method: 'get',
					success: (res) => {
						// console.log(res)
						this.lpeo = res.data.data.lpeo
						// console.log(this.lpeo[0].name)
					}
				})
				this.update = true
			},

			gengduo() {

			},
			open() {
				// console.log('open');
			},
			close() {
				this.show = false
				// console.log('close');
			},
			affirm() { //确认参加
				var m = {
					meetingid: this.conference.mid,
					meetingenter: 1,
					userid: this.user.eid
				}
				this.amend(m)
				this.showToast(this.lists[0])
			},
			refuse() { //拒绝
				var m = {
					meetingid: this.conference.mid,
					meetingenter: 2,
					userid: this.user.eid
				}
				this.amend(m)
				this.showToast(this.lists[0])
			},
			compile() { //编辑

				this.lists[1].url = "./compile?mid=" + this.conference.mid
				console.log(this.lists[1])
				this.showToast(this.lists[1])
				//使用消息提示 跳转页面
				// uni.navigateTo({
				// 			url: "./mydetails?mid=" + e.mid,
				// })
				this.show = false
			},
			cancel() { //取消会议
				var m = {
					mid: this.conference.mid,
					meetingenter: 4,
				}
				this.amend(m)
				this.showToast(this.lists[0])
			},
			add() { //添加与会人
				uni.navigateTo({
					url: "./emolist?mid=" + this.conference.mid,
				})
			},
			amend(m) { //修改会议状态
				uni.request({
					url: "http://localhost:8007/conference/mine/updateMeetingenter",
					method: 'post',
					data: m,
					success: (res) => {
						this.showToast(this.lists[0])
					}
				})
			},

			amendM(m) { //修改会议
				uni.request({
					url: "http://localhost:8007/conference/mine/updateMine",
					method: 'post',
					data: m,
					success: (res) => {
						this.conference = res.data.data.m
						this.showToast(this.lists[0])
					}
				})
			},

			showToast(params) {
				this.$refs.uToast.show({
					...params,
					complete() {
						params.url && uni.navigateTo({
							url: params.url
						})
					}
				})
			}


		}
	}
</script>

<style lang="scss" scoped>
	.v1 {
		width: 100%;
		height: 30px;
		margin: 0px 0px 0px 30px;
	}

	.t1 {
		color: #a5a2a1;
	}

	.t2 {
		margin-left: 30px;
	}

	.tt2 {
		color: #fa7b90;
	}

	.t3 {
		margin-left: 45px;
	}

	.v2 {
		/* background-color: red; */
		padding-top: 15px;
		margin: 10px 0px 0px 10px;
	}

	.v3 {
		padding-top: 0px;
		height: 200px;
		width: 100%;
		background-color: #fff;
	}

	.v4 {
		width: 100%;
		background-color: #fff;
		height: 300px;
		margin: 30px 0px 0px 0px;
	}

	.v5 {
		width: 100%;
		padding-top: 20px;
		margin-left: 30px;
		font-size: 20px;
	}

	.v6 {
		float: left;
		margin: -24px 0px 0px 100px;
		font-size: 16px;
		color: #9e9aa0;
	}

	.v7 {
		margin: 30px 0px 0px 0px;
		width: 100%;
		height: 50px;
		clear: both;
	}

	/* 头像开始 */

	/*  头部开始	  */
	.flex-row {
		display: flex;
		align-items: flex-start;
	}

	.flex-col {
		display: flex;
		align-items: flex-start;
		flex-direction: column;
	}

	.text {
		clear: both;
		float: left;
		margin: 60px 0px 0px -50px;
		font-size: 16px;
		color: #a6a3a6;
	}

	.vi1 {
		float: left;
		height: 80px;
		background-color: white;
		margin: 30px 0px 0px 15px;
	}

	.vi2 {
		height: 100px;
		margin: 0px 0px 0px 10px;
	}

	.vi3 {
		margin: 0px 0px 0px 0px;
	}

	/* 头像结束 */
	.button1 {
		width: 150px;
		margin-left: 10px;
		background: #2979ff;
		border-radius: 10px;
		border-color: #2979ff;
	}

	.button2 {
		float: left;
		color: #fa8e82;
		width: 150px;
		margin: -40px 0px 0px 165px;
		background: #ffffff;
		border-radius: 10px;
		border-color: #fcd4d2;

	}

	.butt1 {
		padding: 25px 0px 25px 0px;
		font-size: 18px;
		background-color: #ffffff;
		color: #3875f2;
		border-color: #f8f8f8;
		border-radius: 0px;
	}
</style>
